<?php
class CurlRequest{
  public function fetchRequest($request_url){
	$response = null;
	try {
	  $session = curl_init(); 
	  if($session === false)
		die("curl_init failed");
	  else{
		curl_setopt($session, CURLOPT_URL,$request_url);
		curl_setopt($session, CURLOPT_HEADER, false); 
		curl_setopt($session, CURLOPT_RETURNTRANSFER, true); 
		
		/* To do request over https
		curl_setopt($session, CURLOPT_SSL_VERIFYPEER,false);
		curl_setopt($session, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
		if ( !$authenticated ){
			curl_setopt($session, CURLOPT_USERPWD, 'rocking_rajat:hailey');				
		}*/
		$response = curl_exec($session); 
		if($response === false)
			die("Error fetching response");
		curl_close($session);
	  }
	}
	catch(Exception $e){
		echo 'Error:' . $e->getMessage();
	}
	return $response;
  }	
}

?>